<template>
  <div>
    <el-upload
      action=""
      :http-request="()=>{}"
      list-type="picture-card"
      :limit="5"
      :on-preview="handlePictureCardPreview"
      :on-remove="handleRemove">
      <i class="el-icon-plus"></i>
    </el-upload>
  </div>
</template>

<script>
import * as qiniu from 'qiniu-js';

export default {
  data() {
    return {
      waitUploadFile: [],
    }
  },
  methods: {
    // 上传方法
    uploadFile(uploadInfo) {
      const observer = {
        next(res) {
          console.log("success", res)
        },
        error(err) {
          console.log("err", err)
        },
        complete(res) {
          console.log(res)
        }
      }
      console.log(uploadInfo);
      let token = "9jadti0vTaIeF-cbv5J7QATUFHcrpANPWAOAXIW8:EGOaBSr1Nce89DU1gmXvnirvW3I=:eyJzY29wZSI6InlpY2FvLWhlYWRlciIsImRlYWRsaW5lIjoxNjk4OTE1Mjk4fQ=="
      const observable = qiniu.upload(uploadInfo.file, uploadInfo.file.name, token, {}, {})
      const subscription = observable.subscribe(observer) // 上传开始
      // subscription.unsubscribe() // 上传取消
    },
    // 图片删除
    handleRemove(file, fileList) {
      console.log(file, fileList);
      this.waitUploadFile = fileList;
    },
    handleAdd(uploadInfo){},
    // 图片点击预览
    handlePictureCardPreview(file) {
    },
  }
}
</script>

<style scoped lang="scss">

</style>
